package kr.nexmore.slmsample2.nebula_sample;

import java.util.ArrayList;
import java.util.List;

import kr.nexmore.slmsample2.dao.MyTagDao;
import kr.nexmore.slmsample2.vo.TagVo;

import org.eclipse.nebula.widgets.pagination.IPageLoader;
import org.eclipse.nebula.widgets.pagination.PageableController;
import org.eclipse.nebula.widgets.pagination.collections.PageListHelper;
import org.eclipse.nebula.widgets.pagination.collections.PageResult;

public class BoardWidgetServices implements IPageLoader<PageResult<TagVo>> {

	private static final BoardWidgetServices INSTANCE = new BoardWidgetServices();

	private List<TagVo> list;

	public static BoardWidgetServices getInstance() {
		return INSTANCE;
	}

	public BoardWidgetServices() {
		this.list = new ArrayList<TagVo>();
		load();
	}

	@Override
	public PageResult<TagVo> loadPage(PageableController controller) {

		return PageListHelper.createPage(list, controller);
	}

	private void load() {

		MyTagDao tagDao = new MyTagDao();

		list = tagDao.select();

	}

}
